

local mt = ac.skill['焦土']
mt.model1 = [[30329820c2307ab27cf9c9a41383ce22.mdl]]
function mt:on_cooldown()
    local hero = self.owner
    local time = 0.5
    self:gc_clear()
    self:gc(ac.loop(200,function(t)
        if hero:is_alive() and hero:get('魔法')>=self:get_cost() and self:is_cooling()==false then
            hero:add('魔法',-self:get_cost())
            hero:add_buff(self.name){
                time = 8,
                art = self.art,
                tip = [[正在持续对周围造成伤害]],
                pulse = 0.5,
                on_add = function(buff)
                    buff:gc(hero:add_effect(self.model1))
                    buff:gc(hero:add('生命恢复%',self.data2))
                end,
                on_pulse = function(buff)
                    local damage = hero:get('攻击') * self.data1/100 * buff.pulse
                    hero:aoe_damage(hero,600,damage,self)
                end
            }
            self:cooling()
        end
    end))

end




local mt = ac.skill['吞噬']
mt.model1 = [[Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl]]

function mt:on_cooldown()
    local hero = self.owner
    local level = math.ceil(ac.enemy.day/4)
    self:gc(ac.loop(200,function(t)
        local unit = ac.selector('unit'):enemy(hero):range(hero,1200):filter(function(u)
            return u:is_type('Boss')==false and u:is_type('精英')==false
        end):random()
        if unit and hero:get('魔法')>=self:get_cost() then
            hero:add('魔法',-self:get_cost())
            self:gc_clear()
            self:cooling()
            
            ac.lightning({
                id = 'AFOD',
                from = hero,
                to = unit,
                time = 0.25
            })
            ac.wait(150,function()
                unit:add_effect(self.model1):remove()
                unit:kill(hero)
                hero:add('全属性',self.data1)
                ac.texttag {
                    text = ('|cffffff00[吞噬]|n'),
                    font_size = 36,
                    angle = 90,
                    speed = 100,
                    lifespan = 1,
                    fadepoint = 0.5,
                    target = unit:get_point(),
                }
            end)
        end
    end))
end
